/**
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.gitee.huangjianbo.supos.openapi.core.http.request.types;

import com.alibaba.fastjson2.JSON;

import io.gitee.huangjianbo.supos.openapi.core.http.HttpHeader;
import io.gitee.huangjianbo.supos.openapi.core.http.HttpPath;
import io.gitee.huangjianbo.supos.openapi.core.http.request.MultipartFormDataPair;
import io.gitee.huangjianbo.supos.openapi.core.http.request.RequestArguments;

import java.util.*;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import java.util.function.Function;

/**
 * @author tomcat
 * @version 1.0
 */
public final class RMap<K, V> implements Map<K, V>, RequestArguments {
    private static final long serialVersionUID = -5505420124730997120L;

    private final Map<K, V> data = new HashMap<>();

    @Override
    public String toQueryString() {
        return "";
    }

    @Override
    public HttpHeader toHeader() {
        return HttpHeader.of();
    }

    @Override
    public String toBodyJsonString() {
        return JSON.toJSONString(data);
    }

    @Override
    public HttpPath toHttpPath(HttpPath definePath) {
        return definePath;
    }

    @Override
    public List<MultipartFormDataPair> toMultipartFormData() {
        return new ArrayList<>();
    }

    @Override
    public int size() {
        return data.size();
    }

    @Override
    public boolean isEmpty() {
        return data.isEmpty();
    }

    @Override
    public boolean containsKey(Object key) {
        return data.containsKey(key);
    }

    @Override
    public boolean containsValue(Object value) {
        return data.containsValue(value);
    }

    @Override
    public V get(Object key) {
        return data.get(key);
    }

    @Override
    public V put(K key, V value) {
        return data.put(key, value);
    }

    @Override
    public V remove(Object key) {
        return data.remove(key);
    }

    @Override
    public void putAll(Map<? extends K, ? extends V> m) {
        data.putAll(m);
    }

    @Override
    public void clear() {
        data.clear();
    }

    @Override
    public Set<K> keySet() {
        return data.keySet();
    }

    @Override
    public Collection<V> values() {
        return data.values();
    }

    @Override
    public Set<Entry<K, V>> entrySet() {
        return data.entrySet();
    }

    @Override
    public V getOrDefault(Object key, V defaultValue) {
        return data.getOrDefault(key, defaultValue);
    }

    @Override
    public void forEach(BiConsumer<? super K, ? super V> action) {
        data.forEach(action);
    }

    @Override
    public void replaceAll(BiFunction<? super K, ? super V, ? extends V> function) {
        data.replaceAll(function);
    }

    @Override
    public V putIfAbsent(K key, V value) {
        return data.putIfAbsent(key, value);
    }

    @Override
    public boolean remove(Object key, Object value) {
        return data.remove(key, value);
    }

    @Override
    public boolean replace(K key, V oldValue, V newValue) {
        return data.replace(key, oldValue, newValue);
    }

    @Override
    public V replace(K key, V value) {
        return data.replace(key, value);
    }

    @Override
    public V computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction) {
        return data.computeIfAbsent(key, mappingFunction);
    }

    @Override
    public V computeIfPresent(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
        return data.computeIfPresent(key, remappingFunction);
    }

    @Override
    public V compute(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
        return data.compute(key, remappingFunction);
    }

    @Override
    public V merge(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction) {
        return data.merge(key, value, remappingFunction);
    }
}
